<?php
	session_start();
	mysql_connect("localhost", "sapmenet_admin", "a1s2d3f4g5h6j7") or die ("Problem with datebase");
	mysql_select_db("sapmenet_users");
	$id=mysql_query("SELECT album FROM pictures WHERE ID={$_POST['picID']}");
	$id=mysql_result($id, 0);
	$id=mysql_query("SELECT userID FROM albums WHERE ID={$id}");
	$id=mysql_result($id, 0);
	if ($id==$_SESSION['JID'])
	{
		mysql_query("DELETE FROM comments WHERE picID={$_POST['picID']}");
		mysql_query("DELETE FROM pictures WHERE ID={$_POST['picID']}");
	}
	?>